Commas only.

Darren Cauthon 9 年 前
コミット
921bbeeaba
共有3 個のファイルを変更した4 個の追加7 個の削除を含む
  1. 0 3
      Gemfile.lock
  2. 2 2
      app/models/agents/webhook_agent.rb
  3. 2 2
      spec/models/agents/webhook_agent_spec.rb

+ 0 - 3
Gemfile.lock

@@ -609,6 +609,3 @@ DEPENDENCIES
609 609
   weibo_2!
610 610
   wunderground (~> 1.2.0)
611 611
   xmpp4r (~> 0.5.6)
612
-
613
-BUNDLED WITH
614
-   1.10.6

+ 2 - 2
app/models/agents/webhook_agent.rb

@@ -21,7 +21,7 @@ module Agents
21 21
           used as the Event payload.  If `payload_path` points to an array,
22 22
           Events will be created for each element.
23 23
         * `verbs` - Comma-separated list of http verbs your agent will accept.
24
-          For example, "post;get" will enable POST and GET requests. Defaults
24
+          For example, "post,get" will enable POST and GET requests. Defaults
25 25
           to "post".
26 26
       MD
27 27
     end
@@ -46,7 +46,7 @@ module Agents
46 46
       return ["Not Authorized", 401] unless secret == interpolated['secret']
47 47
 
48 48
       #check the verbs
49
-      verbs = (interpolated['verbs'] || 'post').split(/[,;]/).map { |x| x.strip.downcase }
49
+      verbs = (interpolated['verbs'] || 'post').split(/,/).map { |x| x.strip.downcase }
50 50
       return ["Please use #{verbs.join('/').upcase} requests only", 401] unless verbs.include?(method)
51 51
 
52 52
       [payload_for(params)].flatten.each do |payload|

+ 2 - 2
spec/models/agents/webhook_agent_spec.rb

@@ -62,7 +62,7 @@ describe Agents::WebhookAgent do
62 62
 
63 63
       context "accepting get and post" do
64 64
 
65
-        before { agent.options['verbs'] = 'get;post' }
65
+        before { agent.options['verbs'] = 'get,post' }
66 66
 
67 67
         it "should accept GET" do
68 68
           out = nil
@@ -166,7 +166,7 @@ describe Agents::WebhookAgent do
166 166
 
167 167
       context "flaky content with commas" do
168 168
 
169
-        before { agent.options['verbs'] = ';;  PUT,POST; gEt , ;' }
169
+        before { agent.options['verbs'] = ',,  PUT,POST, gEt , ,' }
170 170
 
171 171
         it "should accept PUT" do
172 172
           out = nil